<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

    <style>
        * {
            margin: 0;
            padding: 0;
        }

        .box1 {
            position: absolute;
            left: 20px;
            top: 20px;
            width: 200px;
            height: 200px;
            background-color: red;
            z-index: 9;
            /* 值越高 ,层级越高(上层展示) */
            /* 整数 ,取到很大  999  99999   999999 */


            /* 注意的问题 ,,只有 定位 元素  ,才可以设置 z-index 属性 */



        }

        .box2 {
            position: absolute;
            left: 50px;
            top: 50px;
            width: 200px;
            height: 200px;
            background-color: orange;
            z-index: 2;

        }

        .box3 {
            position: absolute;
            left: 80px;
            top: 80px;
            width: 200px;
            height: 200px;
            background-color: black;
        }
        .inner{
            position: absolute;
            left: 0;
            top: 50px;
            width: 50px;
            height: 50px;
            background-color: blue;
            z-index: 999;

            /* 作为一个子元素,层级再高,也无法 突破父元素的层级限制 */
        }
    </style>
</head>

<body>
    <div class="box1">
        box1
    </div>
    <div class="box2">
        box2
        <div class="inner">
            inner
        </div>
    </div>
    <div class="box3">
        box3
    </div>
</body>

</html>